package com.example.sunlight.interneteverything.View;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.view.View;

/**
 * Created by SunLight on 2017/8/8.
 */

public class HealthPlayView extends View {

    public HealthPlayView(Context context) {
        super(context);

    }

    public HealthPlayView(Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
    }

    public HealthPlayView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    int col = Color.argb(200, 255, 255, 255);

    @Override
    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);
        Paint paint = new Paint();
        paint.setColor(col);
        paint.setAntiAlias(true);
        paint.setStrokeWidth(2);
        paint.setTextSize(15);
        canvas.drawText("1000", 0, 30, paint);
        canvas.drawText("500", 0, 100, paint);
        drawText(canvas, paint);
        drawSan(canvas, paint);
        canvas.drawLine(0, 10, 410, 10, paint);
        canvas.drawLine(0, 80, 410, 80, paint);
        canvas.drawLine(0, 150, 410, 150, paint);
    }

    String[] clocks = {"0:00", "6:00", "12:00", "18:00"};

    public void drawText(Canvas canvas, Paint paint) {
        for (int i = 0; i < clocks.length; i++) {
            canvas.drawText(clocks[i], (110 * i), 170, paint);
        }
    }

    public void drawSan(Canvas canvas, Paint paint) {
        for (int i = 0; i < 8; i++) {
            canvas.drawLine((55 * i) + 15, 150, (55 * i) + 15, 145, paint);
        }


    }
}
